package lsl.leetCode.year2023.test0125;

import java.util.HashMap;

public class test01 {
    public static void main(String[] args) {
        int[] nums = {1, 2, 4, 6, 7, 8, 10};
        twoSum(nums, 11);
    }

    public static int[] twoSum(int[] nums, int target) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (map.containsKey(target - nums[i])) {
                System.out.println(map.get(target - nums[i]) + "----" + i);
                return new int[]{map.get(target - nums[i]), i};
            }
            map.put(nums[i], i);
        }
        return null;
    }
}
